package nicg.st.util;

/**
 * @author GeChen
 * @Description
 * @date 2019/11/3 23:20
 */
public class EncodeMatrix {
    public static String EncodeMatrix(Double[][] matrix, int length) {
        StringBuilder stringBuilder = new StringBuilder();
        stringBuilder.append(length);
        stringBuilder.append("[");
        for (int i = 0; i < length; i++) {
            for (int j = 0; j < length; j++) {
                stringBuilder.append(matrix[i][j]);
                if (i != length - 1 || j != length - 1) {
                    stringBuilder.append(' ');
                }
            }
        }
        stringBuilder.append(']');
        return stringBuilder.toString();
    }
}